#include"thread.hpp"
#include"threadPool.hpp"
#include<iostream>
#include<unistd.h>
#include<time.h>
#include"log.hpp"

int main()//主线程生产任务
{
    srand((unsigned long)time(nullptr)^getpid());
    ThreadPool<task>*tp=new ThreadPool<task>();
    char op[4]={'+','-','*','/'};
    
    tp->run();
    while(true)
    {
        int x=rand()%100+1;
        usleep(1000);
        int y=rand()%50+1;
        char c=op[rand()%4];
        task t(x,y,c);
        
        tp->push_task(t);
        logMessage(NORMAL,"%s %d %c %d %s","推送任务成功：",x,c,y,"=?");
        //cout<<"推送任务成功:"<<x<<c<<y<<"=?"<<endl;
        sleep(1);
     
    }
    return 0;
}